
#ifndef SX_VEGA_TETGEN_MASS_SPRING_SYSTEM_STORAGE_H
#define SX_VEGA_TETGEN_MASS_SPRING_SYSTEM_STORAGE_H

#include <sxSimulationObjectStorage.h>
#include <sxMassSpringMesh.h>
#include <sxMassSpringSystem.h>
#include <sxTetrahedralMesh.h>

namespace Sx {
namespace Vega {
namespace Storage {

/* Storage type specifications */
using Graphics::Objects::Mesh;
using Simulation::MassSpringSystem;
using Simulation::Objects::MassSpringMesh;
using Simulation::Objects::Rendering::RendererImplementation;

class Vega_TetgenMassSpringMeshStorage : public Simulation::Storage::SimulationObjectStorage<MassSpringMesh, Mesh, MassSpringSystem> {
public:
	Vega_TetgenMassSpringMeshStorage();
	virtual ~Vega_TetgenMassSpringMeshStorage();

	/*
	 * The loaded filename must not contain an extension. Tetgen provides a
	 * tetrahedral mesh file as (3) separate files: Node, Element, and Face.
	 * Provide the unique name common to all three of these files. For example:
	 * 
	 *    The filename "MyTetFile" will be translated to:
	 *        MyTetFile.node
	 *        MyTetFile.ele
	 *        MyTetFile.face
	 */
	std::shared_ptr<MassSpringMesh> load(const std::shared_ptr<RendererImplementation>& renderer, const String& filename) const;
	bool save(const String& filename, const std::shared_ptr<MassSpringMesh>& object) const;

protected:
	double density;
	double tensileStiffness;
	double damping;
};

}

}

}

#endif
